/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Valdez
 */
public class Node<E> {
    
    protected E data;                // valor del elemento
    protected Node<E> nextElement;   // referencia al siguiente elemento
    
    // pre: v is a value, next is a reference to remainder of list
// post: an element is constructed as the new head of list
    public Node(E v, Node<E> next){
        data = v;
        nextElement = next;
    }

    // post: constructs a new tail of a list with value v
    public Node(E v){
        this(v,null);
    }
    
    // post: returns reference to next value in list// post: returns reference to next value in list
    public Node<E> next(){
        return nextElement;
    }
    
    // post: sets reference to new next value
    public void setNext(Node<E> next){
        nextElement = next;
    }
    
    // post: returns value associated with this element
    public E value(){
        return data;
    }
    
    // post: sets value associated with this element
    public void setValue(E value){
        data = value;
    }
}
